package com.xique.park.bean.transform.web.records;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import lombok.NoArgsConstructor;

/**
 * 打款状态转换
 *
 * @author WLD
 */
@NoArgsConstructor
public class PaymentStatusConverter implements Converter<Integer> {

    @Override
    public Class<Integer> supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public CellData<String> convertToExcelData(Integer value, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        switch (value) {
            case 1:
                return new CellData<>("未结算");
            case 2:
                return new CellData<>("成功");
            case 3:
                return new CellData<>("异常");
            default:
                return new CellData<>("未知");
        }
    }

    @Override
    public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }
}
